<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="inc/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <%@ include file="inc/meta.jsp" %>
    <meta name="description" content="">
    <meta name="author" content="">
    <title>反馈问题详情</title>
    <%@ include file="inc/css.jsp" %>
</head>
<body>

<div id="posts" class="wrapper">

    <%@ include file="inc/nav.jsp" %>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">反馈问题管理</h1>
                <h4 style="margin-left: 10px;">——添加反馈问题</h4>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <form id="questionInfoForm" method="post" action="admin/question/save" class="form-horizontal" role="form">
                            <input type="hidden" id="questionIdId" name="id" value="${question.id}"/>
                            <input type="hidden" id="tempTypeId" value="${question.type.id}"/>
                            <input type="hidden" id="tempLevel" value="${question.area.level}"/>
                            <input type="hidden" id="firstAreaId" value="${firstAreaId}"/>
                            <input type="hidden" id="twoAreaId" value="${twoAreaId}"/>
                            <input type="hidden" id="threeAreaId" value="${threeAreaId}"/>
                            <input type="hidden" id="sectionOne" value="${question.sectionOne}"/>
                            <input type="hidden" id="nameOne" value="${question.nameOne}"/>
                            <input type="hidden" id="sectionTwo" value="${question.sectionTwo}"/>
                            <input type="hidden" id="nameTwo" value="${question.nameTwo}"/>
                            <input type="hidden" name="isCut" value="${question.isCut}"/>
                            <input type="hidden" name="status" value="${question.status}"/>
                            <input type="hidden" name="areaId" id="tempAreaId"/>
                            <span id="tempAddImageIds" style="display: none"></span>
                            <span id="tempDelImageIds" style="display: none"></span>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">问题分类:</label>

                                <div class="col-sm-6">
                                    <select id="typeList" class="form-control" style="width: 200px">
                                        <option value="">请选择问题分类</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">记录日期:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control input-append date form_datetime" style="width: 180px;" readonly id="recordDate" name="recordDate" maxlength="20" value="${question.recordDate}" placeholder="请选择记录日期"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">区域/工段:</label>
                                <div class="col-sm-2">
                                    <select id="areaListOne" class="form-control" style="width: 200px"></select>
                                </div>
                                <div class="col-sm-2" style="display: none;">
                                    <select id="areaListTwo" class="form-control" style="width: 200px;"></select>
                                </div>
                                <div class="col-sm-2" style="display: none;">
                                    <select id="areaListThree" class="form-control" style="width: 200px;"></select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">设备/设施作业描述:</label>
                                <div class="col-sm-9">
                                    <textarea cols="40" rows="8" class="form-control" style="resize: none;" name="descriptionOne" id="descriptionOne">${question.descriptionOne}</textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">图片说明:</label>

                                <div class="col-sm-10">
                                    <div style="float: left;margin-bottom: 30px;" id="lastImageDiv">
                                        <a href="javascript:void(0);" onclick="_questionInfo.fn.AddTempImg()">
                                            <img id="tempPicture" src="static/images/add.jpg" style="height: 200px; width: 200px; display: inherit; margin-bottom: 6px;" border="1"/>
                                        </a>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">风险描述:</label>
                                <div class="col-sm-9">
                                    <textarea cols="40" rows="8" class="form-control" style="resize: none;" name="descriptionTwo" id="descriptionTwo">${question.descriptionTwo}</textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">发现区域得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreOne" name="scoreOne" maxlength="11" value="${question.scoreOne}" placeholder="请输入发现区域得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">专业程度得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreTwo" name="scoreTwo" maxlength="11" value="${question.scoreTwo}" placeholder="请输入专业程度得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">关键程度得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreThree" name="scoreThree" maxlength="11" value="${question.scoreThree}" placeholder="请输入关键程度得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">事故可能性得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreFour" name="scoreFour" maxlength="11" value="${question.scoreFour}" placeholder="请输入事故可能性得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">法规要求得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreFive" name="scoreFive" maxlength="11" value="${question.scoreFive}" placeholder="请输入法规要求得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">计算得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreSix" name="scoreSix" maxlength="11" value="${question.scoreSix}" placeholder="请输入计算得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">实际得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreSeven" name="scoreSeven" maxlength="11" value="${question.scoreSeven}" placeholder="请输入实际得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">反馈人所属部门:</label>

                                <div class="col-sm-3">
                                    <select id="sectionList" onchange="_questionInfo.fn.loadMemberList(1)" class="form-control" style="width: 300px;margin-bottom: 5px;">
                                        <option value="">请选择反馈人所属部门</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">反馈人姓名:</label>

                                <div class="col-sm-3">
                                    <select id="memberList" class="form-control" style="width: 200px;margin-bottom: 5px;">
                                        <option value="">请选择反馈人</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施描述:</label>
                                <div class="col-sm-9">
                                    <textarea cols="40" rows="8" class="form-control" style="resize: none;" name="descriptionThree" id="descriptionThree">${question.descriptionThree}</textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施判别得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreEight" name="scoreEight" maxlength="11" value="${question.scoreEight}" placeholder="请输入临时措施判别得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施计算得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreNine" name="scoreNine" maxlength="11" value="${question.scoreNine}" placeholder="请输入临时措施计算得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施实际得分:</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" id="scoreTen" name="scoreTen" maxlength="11" value="${question.scoreTen}" placeholder="请输入临时措施实际得分"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施责任人所属部门:</label>

                                <div class="col-sm-3">
                                    <select id="sectionListTwo" onchange="_questionInfo.fn.loadMemberList(2)" class="form-control" style="width: 300px;margin-bottom: 5px;">
                                        <option value="">请选择临时措施责任人所属部门</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施责任人姓名:</label>

                                <div class="col-sm-3">
                                    <select id="memberListTwo" class="form-control" style="width: 300px;margin-bottom: 5px;">
                                        <option value="">请选择临时措施责任人</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施计划完成日期:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control input-append date form_datetime" style="width: 180px;" readonly id="planDateOne" name="planDateOne" maxlength="20" value="${question.planDateOne}" placeholder="请选择临时措施计划完成日期"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">临时措施实际关闭日期:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control input-append date form_datetime" style="width: 180px;" readonly id="actualDateOne" name="actualDateOne" maxlength="20" value="${question.actualDateOne}" placeholder="请选择临时措施实际关闭日期"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-12" style="text-align: center">
                                    <button type="button" class="btn btn-primary" onclick="_questionInfo.fn.subInfo()">提交</button>
                                    <a href="admin/question/index" class="btn btn-primary" role="button">返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!-- /.panel-body -->

                    <form id="tempImageForm" method="post" action="admin/addTempImage" enctype="multipart/form-data" class="form-horizontal" role="form">
                        <input type="file" name="tempImage" id="tempImage" data-rule="required" style="display:none;" onchange="_questionInfo.fn.saveTempImage()"/>
                    </form>

                    <div id="tempDiv" style="display:none;float: left; height: 210px;width: 200px;margin-right:6px; z-index: 0;margin-bottom: 15px;">
                        <img src="" style="height: 200px;width: 200px; z-index: 1;"/>
                        <input name="imageIdTemp" type="hidden"/>
                        <a href="javascript:void(0);" style="float: none; z-index: 10; position: relative; bottom: 200px; left: 184px; display: none;" class="axx" onclick="_questionInfo.fn.deleteImage(this)">
                            <img id="pic" src="static/images/xx.png" style="height: 16px; width: 16px; display: inline;" border="1"/>
                        </a>
                    </div>

                </div>
                <!-- /.panel -->
            </div>
        </div>


    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<%@ include file="inc/footer.jsp" %>

</body>
<script type="text/javascript">
    var _questionInfo = {
        v: {
            id: "_questionInfo",
            list: [],
            dTable: null,
            imageSize: 0
        },
        fn: {
            init: function () {
                $.ajaxSetup({
                    async: false
                });

                if ($("#questionId").val() != "") {
                    $("#showH").text("——编辑反馈问题");
                }

                $('.form_datetime').datetimepicker({
                    minView: "month", //选择日期后，不会再跳转去选择时分秒
                    format: "yyyy-mm-dd HH:mm:ss", //选择日期后，文本框显示的日期格式
                    language: 'zh-CN', //汉化
                    autoclose: true //选择日期后自动关闭
                });

                _questionInfo.fn.loadData();

                $('#typeList').change(function () {
                    var selectTypeId = $(this).val();
                    if (null != selectTypeId && selectTypeId != '') {
                        if (selectTypeId == 6 || selectTypeId == 8 || selectTypeId == 18) {
                            // 这三个问题需要计算得分
                            _questionInfo.fn.changeSelectStatus(true);
                        } else {
                            _questionInfo.fn.changeSelectStatus(false);
                        }
                    } else {
                        _questionInfo.fn.changeSelectStatus(false);
                    }
                });

                $('#areaListOne').change(function () {
                    $('#firstAreaId').val('');
                    $('#twoAreaId').val('');
                    $('#threeAreaId').val('');

                    if ($(this).val() != '') {
                        $('#tempAreaId').val($(this).val());

                        $leoman.ajax("admin/area/areaInfo", {
                            areaId: $(this).val()
                        }, function (result) {
                            console.log(result);
                            if (null != result) {
                                $('#tempLevel').val(result.size);
                                if (result.size == 1) {
                                    $('#areaListTwo').parent().css('display', 'none');
                                    $('#areaListThree').parent().css('display', 'none');
                                } else if (result.size == 2) {
                                    $('#areaListTwo').parent().css('display', '');
                                    $('#areaListThree').parent().css('display', 'none');
                                } else {
                                    $('#areaListTwo').parent().css('display', '');
                                    $('#areaListThree').parent().css('display', '');
                                }
                            } else {
                                $leoman.notify("获取区域信息失败", "error");
                            }
                        });
                    } else {
                        $('#areaListTwo').parent().css('display', 'none');
                        $('#areaListThree').parent().css('display', 'none');
                    }

                    _questionInfo.fn.getAreaListTwo($(this).val());
                });

                $('#areaListTwo').change(function () {
                    $('#twoAreaId').val('');
                    $('#threeAreaId').val('');

                    if ($(this).val() != '') {
                        $('#tempAreaId').val($(this).val());
                    }

                    var level = $('#tempLevel').val();
                    if (level == 2) {
                        $('#areaListThree').css('display', 'none');
                    } else {
                        $('#areaListThree').css('display', '');
                    }

                    _questionInfo.fn.getAreaListThree($(this).val());
                });

                $('#areaListThree').change(function () {
                    if ($(this).val() != '') {
                        $('#tempAreaId').val($(this).val());
                    }
                });

                var tempLevel = $('#tempLevel').val();
                if (null != tempLevel && tempLevel != '') {
                    if (tempLevel == 2) {
                        $('#areaListTwo').parent().css('display', '');
                    } else {
                        $('#areaListTwo').parent().css('display', '');
                        $('#areaListThree').parent().css('display', '');
                    }
                }
            },
            changeSelectStatus: function (flag) {
                if (flag) {
                    // 为true则显示
                    $('#scoreOne').parent().parent().css('display', '');
                    $('#scoreTwo').parent().parent().css('display', '');
                    $('#scoreThree').parent().parent().css('display', '');
                    $('#scoreFour').parent().parent().css('display', '');
                    $('#scoreFive').parent().parent().css('display', '');
                    $('#scoreSix').parent().parent().css('display', '');

                    $('#scoreEight').parent().parent().css('display', '');
                    $('#scoreNine').parent().parent().css('display', '');
                } else {
                    // 为false则隐藏
                    $('#scoreOne').parent().parent().css('display', 'none');
                    $('#scoreTwo').parent().parent().css('display', 'none');
                    $('#scoreThree').parent().parent().css('display', 'none');
                    $('#scoreFour').parent().parent().css('display', 'none');
                    $('#scoreFive').parent().parent().css('display', 'none');
                    $('#scoreSix').parent().parent().css('display', 'none');

                    $('#scoreEight').parent().parent().css('display', 'none');
                    $('#scoreNine').parent().parent().css('display', 'none');
                }
            },
            lazyLoadSelect: function () {
                var tempLevel = $('#tempLevel').val();

                if (null != tempLevel && tempLevel != '') {
                    switch (Number(tempLevel)) {
                        case 1:
                            $('#areaListTwo').parent().css('display', 'none');
                            $('#areaListThree').parent().css('display', 'none');
                            break;
                        case 2:
                            $('#areaListThree').parent().css('display', 'none');
                            break;
                    }
                }
            },
            loadData: function () {
                // 加载下拉框信息
                _questionInfo.fn.getSelectList();

                _questionInfo.fn.lazyLoadSelect();

                _questionInfo.fn.getAreaListOne();

                _questionInfo.fn.getSerImages();

                _questionInfo.fn.getContactList();

                var tempTypeId = $('#typeList option:selected').val();
                if (null != tempTypeId && tempTypeId != '') {
                    if (tempTypeId == 6 || tempTypeId == 8 || tempTypeId == 18) {
                        // 这三个问题需要计算得分
                        _questionInfo.fn.changeSelectStatus(true);
                    } else {
                        _questionInfo.fn.changeSelectStatus(false);
                    }
                }
            },
            getSerImages: function () {
                var imgList = ${imageList };

                // 计算当前商品图片数量
                _questionInfo.v.imageSize = imgList.length;

                $.each(imgList, function (i, item) {
                    if (null != item) {
                        _questionInfo.fn.insertImage(item.url, item.id);
                    } else {
                        $('#lastImageDiv').html('暂无');
                    }
                });
            },
            AddTempImg: function () {
                // a标签绑定onclick事件
                $('#tempImage').click();
            },
            saveTempImage: function () {
                $("#tempImageForm").ajaxSubmit({
                    dataType: "json",
                    success: function (data) {
                        if (null != data.url && data.url != '') {
                            $('#tempAddImageIds').html($('#tempAddImageIds').html() + data.id + ',');
                            _questionInfo.fn.insertImage(data.url, data.id);

                            _questionInfo.v.imageSize = _questionInfo.v.imageSize + 1;
                        } else {
                            $leoman.notify("图片格式不正确", "error");
                        }
                    }
                });
            },
            insertImage: function (path, id) {
                var tempDiv = $("#tempDiv").clone();
                tempDiv.prop('id', '');
                tempDiv.css("display", "block");
                tempDiv.children(":first").prop("src", path);
                tempDiv.children(":first").next().prop("value", id);
                tempDiv.insertBefore("#lastImageDiv");

                // 让所有的克隆出来的
                tempDiv.hover(function () {
                    _questionInfo.fn.mouseover($(this));
                }, function () {
                    _questionInfo.fn.mouseOut($(this));
                });
            },
            mouseover: function (mouse) {
                $(mouse).children("a").fadeIn(300);
            },
            mouseOut: function (mouse) {
                $(mouse).children("a").fadeOut(300);
            },
            deleteImage: function (self) {
                _questionInfo.v.imageSize = _questionInfo.v.imageSize - 1;
                var imageId = $(self).prev().val();
                $('#tempDelImageIds').html($('#tempDelImageIds').html() + imageId + ',');
                $(self).parent().remove();
            },
            checkData: function () {
                var flag = true;
                var type = $('#typeList option:selected').val();
                var recordDate = $('#recordDate').val();
                var level = $('#tempLevel').val();
                var tempAreaId = $('#tempAreaId').val();
                var descriptionOne = $('#descriptionOne').val();
                var descriptionTwo = $('#descriptionTwo').val();
                var scoreOne = $('#scoreOne').val();
                var scoreTwo = $('#scoreTwo').val();
                var scoreThree = $('#scoreThree').val();
                var scoreFour = $('#scoreFour').val();
                var scoreFive = $('#scoreFive').val();
                var scoreSix = $('#scoreSix').val();
                var scoreSeven = $('#scoreSeven').val();
                var nameOne = $('#memberList option:selected').val();
                var sectionOne = $('#sectionList option:selected').val();
                var descriptionThree = $('#descriptionThree').val();
                var scoreEight = $('#scoreEight').val();
                var scoreNine = $('#scoreNine').val();
                var scoreTen = $('#scoreTen').val();
                var sectionTwo = $('#sectionListTwo option:selected').val();
                var planDateOne = $('#planDateOne').val();
                var actualDateOne = $('#actualDateOne').val();

                if (null == type || type == '') {
                    $leoman.notify('请选择问题分类', "error");
                    flag = false;
                    return;
                }

                if (null == recordDate || recordDate == '') {
                    $leoman.notify('请选择记录日期', "error");
                    flag = false;
                    return;
                }

                /*if (null == tempAreaId || tempAreaId == '') {
                    $leoman.notify('请选择区域工段', "error");
                    flag = false;
                    return;
                }*/

                if (null == descriptionOne || descriptionOne == '') {
                    $leoman.notify('请输入设备/设施作业描述', "error");
                    flag = false;
                    return;
                }

                /*if (_questionInfo.v.imageSize == 0) {
                 $leoman.notify('请至少上传一张图片', "error");
                 flag = false;
                 return;
                 }

                 if (null == descriptionTwo || descriptionTwo == '') {
                 $leoman.notify('请输入风险描述', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreOne || scoreOne == '') {
                 $leoman.notify('请输入发现区域得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreOne) != scoreOne) {
                 $leoman.notify('发现区域得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreTwo || scoreTwo == '') {
                 $leoman.notify('请输入专业程度得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreTwo) != scoreTwo) {
                 $leoman.notify('专业程度得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreThree || scoreThree == '') {
                 $leoman.notify('请输入关键程度得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreThree) != scoreThree) {
                 $leoman.notify('关键程度得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreFour || scoreFour == '') {
                 $leoman.notify('请输入事故可能性得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreFour) != scoreFour) {
                 $leoman.notify('事故可能性得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreFive || scoreFive == '') {
                 $leoman.notify('请输入法规要求得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreFive) != scoreFive) {
                 $leoman.notify('法规要求得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreSix || scoreSix == '') {
                 $leoman.notify('请输入计算得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreSix) != scoreSix) {
                 $leoman.notify('计算得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreSeven || scoreSeven == '') {
                 $leoman.notify('请输入实际得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreSeven) != scoreSeven) {
                 $leoman.notify('实际得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == nameOne || nameOne == '') {
                 $leoman.notify('请输入反馈人姓名', "error");
                 flag = false;
                 return;
                 }

                 if (null == sectionOne || sectionOne == '') {
                 $leoman.notify('请输入反馈人所属部门', "error");
                 flag = false;
                 return;
                 }

                 if (null == descriptionThree || descriptionThree == '') {
                 $leoman.notify('请输入临时措施描述', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreEight || scoreEight == '') {
                 $leoman.notify('请输入临时措施判别得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreEight) != scoreEight) {
                 $leoman.notify('临时措施判别得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreNine || scoreNine == '') {
                 $leoman.notify('请输入临时措施计算得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreNine) != scoreNine) {
                 $leoman.notify('临时措施计算得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == scoreTen || scoreTen == '') {
                 $leoman.notify('请输入临时措施实际得分', "error");
                 flag = false;
                 return;
                 }

                 if (Math.floor(scoreTen) != scoreTen) {
                 $leoman.notify('临时措施实际得分须为整数', "error");
                 flag = false;
                 return;
                 }

                 if (null == sectionTwo || sectionTwo == '') {
                 $leoman.notify('请输入临时措施责任人所属部门', "error");
                 flag = false;
                 return;
                 }

                 if (null == planDateOne || planDateOne == '') {
                 $leoman.notify('请选择临时措施计划完成日期', "error");
                 flag = false;
                 return;
                 }

                 if (null == actualDateOne || actualDateOne == '') {
                 $leoman.notify('请选择临时措施实际关闭日期', "error");
                 flag = false;
                 return;
                 }*/

                return flag;
            },
            getSelectList: function () {
                var typeId = $('#tempTypeId').val();

                $leoman.ajax("admin/typeList", null, function (result) {
                    if (null != result) {
                        // 获取返回的反馈类型信息，并循环绑定到label中
                        var content = "";
                        jQuery.each(result, function (i, item) {
                            if (null != typeId && typeId != '' && typeId == item.id) {
                                content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                            } else {
                                content += "<option value='" + item.id + "'>" + item.name + "</option>";
                            }
                        });
                        $('#typeList').append(content);
                    } else {
                        $leoman.notify("获取反馈类型信息失败", "error");
                    }
                });
            },
            getContactList: function () {
                var sectionOne = $('#sectionOne').val();
                var sectionTwo = $('#sectionTwo').val();
                $leoman.ajax("admin/sectionList", null, function (result) {
                    if (null != result) {
                        // 获取返回的部门信息，并循环绑定到label中
                        var content = "";
                        if (null != sectionOne && sectionOne != '') {
                            jQuery.each(result, function (i, item) {
                                if (item.name == sectionOne) {
                                    content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                                } else {
                                    content += "<option value='" + item.id + "'>" + item.name + "</option>";
                                }
                            });
                            $('#sectionList').append(content);

                            _questionInfo.fn.loadMemberList(1);
                        } else {
                            jQuery.each(result, function (i, item) {
                                content += "<option value='" + item.id + "'>" + item.name + "</option>";
                            });
                            $('#sectionList').append(content);
                        }

                        content = "";
                        if (null != sectionTwo && sectionTwo != '') {
                            jQuery.each(result, function (i, item) {
                                if (item.name == sectionTwo) {
                                    content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                                } else {
                                    content += "<option value='" + item.id + "'>" + item.name + "</option>";
                                }
                            });
                            $('#sectionListTwo').append(content);

                            _questionInfo.fn.loadMemberList(2);
                        } else {
                            jQuery.each(result, function (i, item) {
                                content += "<option value='" + item.id + "'>" + item.name + "</option>";
                            });
                            $('#sectionListTwo').append(content);
                        }
                    } else {
                        $leoman.notify("获取部门信息失败", "error");
                    }
                });
            },
            loadMemberList: function (type) {
                var nameOne = $('#nameOne').val();
                var nameTwo = $('#nameTwo').val();

                var contactId = null;
                if (type == 1) {
                    contactId = $('#sectionList option:selected').val();
                } else {
                    contactId = $('#sectionListTwo option:selected').val();
                }

                if (null != contactId && contactId != '') {
                    $leoman.ajax("admin/memberList", {
                        contactId: contactId
                    }, function (result) {
                        if (null != result) {
                            // 获取返回的部门人员信息，并循环绑定到label中
                            var content = "<option value=''>请选择反馈人</option>";
                            if (type == 1) {
                                $('#memberList').html('');
                                jQuery.each(result, function (i, item) {
                                    if (item.name == nameOne) {
                                        content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                                    } else {
                                        content += "<option value='" + item.id + "'>" + item.name + "</option>";
                                    }
                                });
                                $('#memberList').append(content);
                            } else {
                                $('#memberListTwo').html('');
                                jQuery.each(result, function (i, item) {
                                    if (item.name == nameTwo) {
                                        content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                                    } else {
                                        content += "<option value='" + item.id + "'>" + item.name + "</option>";
                                    }
                                });
                                $('#memberListTwo').append(content);
                            }
                        } else {
                            $leoman.notify("获取部门人员信息失败", "error");
                        }
                    });
                }
            },
            getAreaListOne: function () {
                $('#areaListOne').html('<option value="">请选择区域/工段</option>');

                var firstAreaId = $('#firstAreaId').val();

                $leoman.ajax("admin/areaList", null, function (result) {
                    if (null != result) {
                        // 获取返回的区域信息，并循环绑定到label中
                        var content = "";
                        jQuery.each(result, function (i, item) {
                            if (null != firstAreaId && firstAreaId != '' && firstAreaId == item.id) {
                                content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                            } else {
                                content += "<option value='" + item.id + "'>" + item.name + "</option>";
                            }
                        });
                        $('#areaListOne').append(content);

                        var areaId = $('#areaListOne option:selected').val();
                        _questionInfo.fn.getAreaListTwo(areaId);
                    } else {
                        $leoman.notify("获取区域信息失败", "error");
                    }
                });
            },
            getAreaListTwo: function (areaId) {
                $('#areaListTwo').html('<option value="">请选择区域/工段</option>');

                var twoAreaId = $('#twoAreaId').val();

                $leoman.ajax("admin/areaListPlus", {
                    areaId: areaId
                }, function (result) {
                    if (null != result) {
                        // 获取返回的区域信息，并循环绑定到label中
                        var content = "";
                        jQuery.each(result, function (i, item) {
                            if (null != twoAreaId && twoAreaId != '' && twoAreaId == item.id) {
                                content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                            } else {
                                content += "<option value='" + item.id + "'>" + item.name + "</option>";
                            }
                        });
                        $('#areaListTwo').append(content);

                        var areaId = $('#areaListTwo option:selected').val();
                        _questionInfo.fn.getAreaListThree(areaId);
                    } else {
                        $leoman.notify("获取区域信息失败", "error");
                    }
                });
            },
            getAreaListThree: function (areaId) {
                $('#areaListThree').html('<option value="">请选择区域/工段</option>');

                var threeAreaId = $('#threeAreaId').val();

                $leoman.ajax("admin/areaListPlus", {
                    areaId: areaId
                }, function (result) {
                    if (null != result) {
                        // 获取返回的区域信息，并循环绑定到label中
                        var content = "";
                        jQuery.each(result, function (i, item) {
                            if (null != threeAreaId && threeAreaId != '' && threeAreaId == item.id) {
                                content += "<option value='" + item.id + "' selected>" + item.name + "</option>";
                            } else {
                                content += "<option value='" + item.id + "'>" + item.name + "</option>";
                            }
                        });
                        $('#areaListThree').append(content);
                    } else {
                        $leoman.notify("获取区域信息失败", "error");
                    }
                });
            },
            subInfo: function () {
                // 所有的验证通过后，执行新增操作
                if (_questionInfo.fn.checkData()) {
                    var nameTwo = $('#memberListTwo option:selected').val();
                    var nameOne = $('#memberList option:selected').val();
                    var sectionOne = $('#sectionList option:selected').val();
                    var sectionTwo = $('#sectionListTwo option:selected').val();

                    var tempNameTwo = '';
                    var nameText = '';
                    var sectionText = '';
                    var nameTwoText = '';
                    var sectionTwoText = '';

                    if (null != nameTwo && nameTwo != '') {
                        tempNameTwo = $('#memberListTwo option:selected').text();
                    }

                    if (null != nameOne && nameOne != '') {
                        nameText = $('#memberList option:selected').text();
                    }

                    if (null != sectionOne && sectionOne != '') {
                        sectionText = $('#sectionList option:selected').text();
                    }

                    if (null != sectionTwo && sectionTwo != '') {
                        sectionTwoText = $('#sectionListTwo option:selected').text();
                    }

                    $("#questionInfoForm").ajaxSubmit({
                        dataType: "json",
                        data: {
                            type: $('#typeList option:selected').val(),
                            tempAddImageIds: $("#tempAddImageIds").html(),
                            tempDelImageIds: $("#tempDelImageIds").html(),
                            nameOne: nameText,
                            nameTwo: tempNameTwo,
                            sectionOne: sectionText,
                            sectionTwo: sectionTwoText
                        },
                        success: function (data) {
                            if (data > 0) {
                                window.location.href = _basePath + "admin/question/show?id=" + data;
                            } else {
                                $leoman.notify("操作失败", "error");
                            }
                        }
                    });
                }
            },
            goBack: function () {
                window.location.href = "admin/question/index";
            }
        }
    }

    $(document).ready(function () {
        _questionInfo.fn.init();
    });

</script>

</html>